package com.gandong8.trace.tool.config.aliyun.ons.custom;

import com.aliyun.openservices.ons.api.bean.ConsumerBean;
import com.gandong8.trace.tool.config.aliyun.ons.OnsConsumerConf;
import com.gandong8.trace.tool.config.aliyun.ons.properties.custom.TopicTwoProperties;
import com.gandong8.trace.tool.consumer.ons.custom.TopicTwoListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties( TopicTwoProperties.class)
@Slf4j
public class OnsConsumerTwoConf extends OnsConsumerConf {
    @Autowired
    TopicTwoProperties myConf;

    @Bean(name="onsTopicTwoListener", destroyMethod = "shutdown")
    public ConsumerBean getConsumer() {
        TopicTwoListener listener = new TopicTwoListener();
        return super.createConsumer(myConf, listener);
    }
}
